package com.mxpio.erp.common.oa.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mxpio.erp.common.annotation.DictValue;
import com.mxpio.erp.common.jpa.policy.ResCodeGeneratorPolicy;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.BaseEntity;
import com.mxpioframework.security.entity.Dept;
import com.mxpioframework.security.entity.User;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;

@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name = "MB_ERP_OA_HIRE_APPLY")
@Schema(description="招聘申请表")
public class HireApply extends BaseEntity {

    @Id
    @Column(name = "BIZ_NO_", updatable = false)
    @Generator(policy = ResCodeGeneratorPolicy.class)
    @Schema(description = "工单编号")
    private String bizNo;


    @Column(name = "EMPLOYEE_ID_")
    @Schema(description = "申请人")
    @Dict(dicCode="username", dicEntity = User.class, dicText = "nickname")
    private String employeeId;

    @Column(name = "DEPT_CODE_")
    @Schema(description = "部门编号")
    @Dict(dicCode="deptCode", dicEntity = Dept.class, dicText = "deptName")
    private String deptCode;

    @Column(name = "POST_")
    @Schema(description = "增补职位")
    private String post;

    @Column(name = "HIRE_COUNT_")
    @Schema(description = "增补人数")
    private String hireNumber;

    @Column(name = "HIRE_REASON_")
    @Schema(description = "申请增补理由")
    @Dict(dicCode = "MB_ERP_OA_HIRE_REASON")
    @DictValue("10=扩大岗位编制,20=增加人员编制,30=辞职补充,40=短期需要,50=储备人力,60=替换")
    private String hireReason;

    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern="yyyy-MM-dd")
    @Schema(description = "申请时间")
    @Column(name = "APPLY_TIME_")
    private Date applyTime;

    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern="yyyy-MM-dd")
    @Schema(description = "希望到港日期")
    @Column(name = "DUTY_TIME_")
    private Date dutyTime;

    @Column(name = "SEX_")
    @Schema(description = "资格条件-性别")
    @Dict(dicCode = "MB_ERP_OA_HIRE_SEX")
    @DictValue("0=女,1=男")
    private String sex;

    @Column(name = "MARRIAGE_")
    @Schema(description = "资格条件-婚姻")
    @Dict(dicCode = "MB_ERP_OA_HIRE_MARRIAGE")
    @DictValue("10=已婚,20=未婚")
    private String marriage;

    @Column(name = "AGE_")
    @Schema(description = "资格条件-年龄")
    private String age;

    @Column(name = "DEGREE_")
    @Schema(description = "资格条件-学历")
    @Dict(dicCode = "MB_ERP_HR_EMPLOYEE_DEGREE")
    private String degree;

    @Column(name = "FOREIGN_LANGUAGE_")
    @Schema(description = "资格条件-外语")
    private String foreignLanguage;

    @Column(name = "PERSONALITY_")
    @Schema(description = "资格条件-个性")
    private String personality;

    @Column(name = "MAJOR_")
    @Schema(description = "资格条件-专业")
    private String major;

    @Column(name = "WORK_YEAR_")
    @Schema(description = "资格条件-工作经验")
    private Integer workYear;

    @Column(name = "SKILL_")
    @Schema(description = "资格条件-技能")
    private String skill;

    @Column(name = "POST_DUTY_")
    @Schema(description = "资格条件-岗位职责")
    private String postDuty;


    /**审批状态*/
    @Column(name = "BPMN_STATUS_")
    @Schema(description = "审批状态")
    @Dict(dicCode = "ERP_COMMON_BPMN_STATUS")
    private String bpmnStatus;

    /**审批实例ID*/
    @Column(name = "PROCESS_INSTANCE_ID_")
    @Schema(description = "审批实例ID")
    private String processInstanceId;
}
